package org.example.mall.admin.model.entity.manage;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 文件管理表
 * </p>
 *
 * @author hzq
 * @since 2022-01-04
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sys_file")
@ApiModel(value = "SysFile对象", description = "文件管理表")
public class SysFile extends Model<SysFile> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "编号")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "文件名")
    @TableField("file_name")
    private String fileName;

    @ApiModelProperty(value = "存储桶名称")
    @TableField("bucket_name")
    private String bucketName;

    @ApiModelProperty(value = "原始文件名")
    @TableField("original")
    private String original;

    @ApiModelProperty(value = "文件类型（扩展名）")
    @TableField("type")
    private String type;

    @ApiModelProperty(value = "文件大小")
    @TableField("file_size")
    private Long fileSize;

    @ApiModelProperty(value = "上传时间")
    @TableField("create_time")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "更新时间")
    @TableField("update_time")
    private LocalDateTime updateTime;

    @ApiModelProperty(value = "引用次数")
    @TableField("link_num")
    private Integer linkNum;

    @ApiModelProperty(value = "文件md5加密防止文件重复")
    @TableField("md5_hex")
    @JsonIgnore
    private String md5Hex;

    @ApiModelProperty(value = "当为网络附件时的网络原地址")
    @TableField("net_url")
    private String netUrl;

    @ApiModelProperty(value = "文件大类型")
    @TableField("big_type")
    private String bigType;

    @ApiModelProperty(value = "文件小类型")
    @TableField("small_type")
    private String smallType;

    @ApiModelProperty(value = "SysTree.treeId")
    @TableField("tree_id")
    private Integer treeId;

    @ApiModelProperty(value = "访问地址")
    @TableField("url")
    private String url;

    @ApiModelProperty(value = "分类")
    @TableField("classification")
    private String classification;

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
